package com.example.demo.service.impl;

import com.example.demo.dao.ObjectMapper;
import com.example.demo.service.ObjectService;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.demo.modal.Object;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ObjectServiceImpl implements ObjectService{
    @Autowired
    ObjectMapper objectMapper;

    public List<Object> findAll(){
        return objectMapper.selectAll();
    };

    @Override
    //还需要修改！
    public List<Object> findById(int id){
        return objectMapper.selectByPrimaryKey(id);
    }

    @Override
    public int save(Object object){
        return objectMapper.insert(object);
    }

    @Override
    public int delByObj(int id){
        return objectMapper.deleteByPrimaryKey(id);
    };

    @Override
    public int update(Object object){
        return objectMapper.updateByPrimaryKey(object);
    };

    @Override
    public int selectMaxId(){
        return objectMapper.selectMaxId();
    };

    @Override
    public List<Object> findByName(String name){
        return objectMapper.selectByName(name);
    };

    @Override
    public List<Object> findByAbilities(String abilities){
        return objectMapper.selectByAbilities(abilities);
    };

    @Override
    public List<Object> findByRelationship(String relationship){
        return objectMapper.selectByRelationship(relationship);
    };

    @Override
    public List<Object> findByChara(String chara){
        return objectMapper.selectByChara(chara);
    };


}
